<%--
  Created by IntelliJ IDEA.
  User: 宋晓博
  Date: 2022/1/12
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>类别查询</title>
    <meta charset="utf-8"/>
    <link type="text/css" rel="stylesheet" href="/static/bootstrap-3.4.1-dist/css/bootstrap.css"/>
    <link type="text/css" rel="stylesheet" href="/static/css/list.css"/>
</head>
<body>
<script type="text/javascript" src="/static/bootstrap-3.4.1-dist/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/static/bootstrap-3.4.1-dist/js/bootstrap.js"></script>
<script type="text/javascript" src="/static/js/detail.js"></script>
<c:import url="header.jsp"></c:import>
<div class="container">

    <%--进度条--%>
    <div class="progress">
        <div class="progress-bar progress-bar-info progress-bar-striped" role="progressbar" aria-valuenow="20"
             aria-valuemin="0" aria-valuemax="100" style="width: ${requestScope.pb.nowPage/requestScope.pb.pageNum*100}%">
<%--            ${pb.nowPage/pb.pageNum*100}%--%>
        </div>
    </div>


    <div class="row">
        <c:forEach var="goods" items="${requestScope.goodslist }">
                <div class="col-md-3">
                    <div class="thumbnail">
                        <img src="/${goods.pic1}" alt="${goods.name}">
                        <div class="caption">
                            <h3 style="color:#e4006e">￥${goods. price}</h3>
                            <h5 style="color:#666666"><a href="/goods/getDetails?gid=${goods.id}">${goods.name}</a></h5>
                            <div class="small  info" >${goods.info}</div>
                            <h6 style="color:#1a9974">${goods.info1}</h6>
                            <h6 style="color:#1494b0">${goods.info2}</h6>
                            <p>
                                <a href="/cart?method=add&gid=${goods.id}" class="btn btn-primary addcart" role="button">加入购物车</a>
                                <a href="" class="btn btn-default" role="button">立即下单</a>
                            </p>
                        </div>
                    </div>
                </div>
        </c:forEach>
    </div>
    <div class="row">
        <div class="col-md-4 col-md-offset-4">
            <nav class="fenye">
                <ul class="pagination">
                    <li ${requestScope.pb.nowPage==1?"class='disabled'":""}>
                        <a href="/goods/getGoodsByType?page=${pb.nowPage==1?1:pb.nowPage-1}&c1=${c1}&c2=${c2}&c3=${c3}&words=${words}">
                            <span aria-hidden="false">上一页</span>
                        </a>
                    </li>
                    <c:choose>
                        <c:when test="${requestScope.pb.pageNum<=3}">
                            <c:forEach begin="1" end="${requestScope.pb.pageNum}" step="1" var="p">
                                <li ${requestScope.pb.nowPage==p?"class='active'":""}>
                                    <a href="/goods/getGoodsByType?page=${p}&c1=${c1}&c2=${c2}&c3=${c3}&words=${words}">${p}
                                        </span>
                                    </a>
                                </li>
                            </c:forEach>
                        </c:when>
                        <c:otherwise>
                            <c:choose>
                                <c:when test="${requestScope.pb.nowPage==1}">
                                    <c:forEach begin="1" end="3" step="1" var="p">
                                        <li ${requestScope.pb.nowPage==p?"class='active'":""}>
                                            <a href="/goods/getGoodsByType?page=${p}&c1=${c1}&c2=${c2}&c3=${c3}&words=${words}">${p}
                                                </span>
                                            </a>
                                        </li>
                                    </c:forEach>
                                </c:when >
                                <c:when test="${requestScope.pb.nowPage==requestScope.pb.pageNum}">
                                    <c:forEach begin="${requestScope.pb.nowPage-2}" end="${requestScope.pb.nowPage}" step="1" var="p">
                                        <li ${requestScope.pb.nowPage==p?"class='active'":""}>
                                            <a href="/goods/getGoodsByType?page=${p}&c1=${c1}&c2=${c2}&c3=${c3}&words=${words}">${p}
                                                </span>
                                            </a>
                                        </li>
                                    </c:forEach>
                                </c:when>
                                <c:otherwise>
                                    <c:forEach begin="${requestScope.pb.nowPage-1}" end="${requestScope.pb.nowPage+1}" step="1" var="p">
                                        <li ${requestScope.pb.nowPage==p?"class='active'":""}>
                                            <a href="/goods/getGoodsByType?page=${p}&c1=${c1}&c2=${c2}&c3=${c3}&words=${words}">${p}
                                            </a>
                                        </li>
                                    </c:forEach>
                                </c:otherwise>
                            </c:choose>
                        </c:otherwise>
                    </c:choose>
<%--                    <li class="active"><a href="#">1<span class="sr-only">(current)</span></a></li>--%>
<%--                    <li><a href="#">2<span class="sr-only">(current)</span></a></li>--%>
<%--                    <li><a href="#">3<span class="sr-only">(current)</span></a></li>--%>
                    <li ${requestScope.pb.nowPage==pb.pageNum?"class='disabled'":""}>
                        <a href="/goods/getGoodsByType?page=${pb.nowPage==pb.pageNum?pb.nowPage:pb.nowPage+1}&c1=${c1}&c2=${c2}&c3=${c3}&words=${words}">
                            <span aria-hidden="true">下一页</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
</div>
</body>
</html>
